/* 
 * 全市各县区排名情况
 */
function countyRanking(p,id) {
    console.log(id);
    //判断是否为农村或城市居民收入
    var  finishLegend="";
    var  yAxisName="";
    if(id =="A18" ||  id =="A19"){
        finishLegend = "完成值万元";
        yAxisName="万元";
    }else{
        finishLegend = "完成值亿元";
        yAxisName="亿元";
    }
    var option = {
        tooltip: {
            trigger: 'axis',
            // formatter: "{b} : {c} </br> {b1} : {c1}",
            axisPointer: {
                // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        title: {
            left: 'center',
            text: '全市区各县排名情况',
            textStyle: {
                color: "#FDBC0A",
                fontSize: 16,
                fontWeight: "bold"
            }
        },
        grid: {
            left: '0%',
            right: '0%',
            bottom: '0%',
            containLabel: true
        },
        legend: {
            x: "center",
            y: "10%",
            data: [finishLegend , '增长率(%)'],
            textStyle: {
                color: '#fff',
                fontSize: '12',
            }
        },
        xAxis: [{
            type: 'category',
            data: p.areaList,
            axisPointer: {
                type: 'shadow'
            },
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#fff',
                    fontSize: 12 //设置x轴字体
                }
            },
            axisLine: {
                lineStyle: {
                    color: '#fff',
                    width: 1, //这里是为了突出显示加上的
                }
            },
        }],
        yAxis: [{
            type: 'value',
            name: yAxisName ,
            // min: 0,
            // max: 250,
            // interval: 50,
            axisLabel: {
                formatter: '{value} '
            },
            axisLine: {
                lineStyle: {
                    color: '#fff',
                    width: 1, //这里是为了突出显示加上的
                }
            },
            //去掉网格线
            splitLine: {
                show: false
            },

        },
            {
                type: 'value',
                name: '比率 (%)',
                // min: 0,
                // max: 25,
                // interval: 5,
                axisLabel: {
                    formatter: '{value} '
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff',
                        width: 1, //这里是为了突出显示加上的
                    }
                },
                //去掉网格线
                splitLine: {
                    show: false
                },
            }
        ],
        series: [{
            animationDuration: 5000,
            name: finishLegend,
            type: 'bar',
            data: p.cumulativeList,
        },
            {
                animationDuration: 5000,
                name: '增长率(%)',
                type: 'line',
                yAxisIndex: 1,
                data: p.ratioList,
                type: "line",
                symbol: "circle", //设定为实心点
                symbolSize: 12, //设定实心点的大小
                itemStyle: {
                    normal: {
                        color: "#56D7AB", //小圆点颜色
                        lineStyle: {
                            color: "#56D7AB", //折线颜色
                            width: 3
                        }
                    }
                }

            }
        ],
        color: [{ //设置渐变颜色
            x: 0,
            y: 1,
            x2: 0,
            y2: 0,
            type: 'linear',
            colorStops: [{
                offset: 0,
                color: '#4BBCCF'
            },
                {
                    offset: 1,
                    color: '#0084FF'
                }
            ]
        }],
        barWidth: 15
    };


    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('county-ranking'));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}

/* 
 * 增长率仪表盘 dashboard ()
 params  el:ID元素  data:仪表盘值  dataName:仪表盘名  target:市目标
 */
function dashboard(el, data, dataName, target) {
    var option = {
        backgroundColor: '',
        tooltip: {
            formatter: '<div>业务指标</div>{b} : {c}'
        },
        title: {
            left: 'center',
            text: '当季同比增长情况',
            textStyle: {
                color: "#FDBC0A",
                fontSize: 16,
                fontWeight: "bold"
            }
        },
        series: [{
            animationDuration: 5000,
            axisLine: {
                show: true,
                lineStyle: {
                    color: [
                        [0.2, '#0084FF'],
                        [0.8, '#FED147'],
                        [1, '#56D7AB']
                    ],
                    width: 20 //设置环的粗细
                }
            },
            axisTick: {
                show: true
            },
            axisLabel: {
                distance: 6,
                textStyle: {
                    color: 'auto'
                }
            },
            splitLine: { // 分隔线
                length: 20, // 属性length控制线长
                lineStyle: { // 属性lineStyle（详见lineStyle）控制线条样式
                    color: 'auto'
                }
            },
            itemStyle: {
                normal: {
                    color: 'auto'
                }
            },
            radius: '85%',
            pointer: {
                width: 10
            },
            title: {
                offsetCenter: [0, '90%']
            },
            detail: {
                textStyle: {
                    // fontWeight: 'bolder',
                    fontSize: 20,
                    color: '#fff'
                },
                offsetCenter: [0, '58%'],
                formatter: dataName + '\n{value}%'
            },
            // min: 0,
            // max: 100, //县目标最大值
            name: '米类仪表盘',
            type: 'gauge',
            show: false,
            // splitNumber: 10,

            data: [{
                value: data, //县目标实际值
                // name: '县目标100%，第 6 名'
            }]
        }]
    };
    $(".dashboard-data>em").html(target);
    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(el));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });

}


/*
 * 规上工业双仪表盘 doubleDashboard ()
 params  el:ID元素  data:仪表盘值  dataName:仪表盘名  target:市目标 titleName =>表名称
 */
function doubleDashboard(el, data, dataName, target, titleName) {
    var option = {
        backgroundColor: '',
        tooltip: {
            formatter: '<div>业务指标</div>{b} : {c}'
        },
        title: {
            left: 'center',
            text: titleName,
            textStyle: {
                color: "#FDBC0A",
                fontSize: 16,
                fontWeight: "bold"
            }
        },
        series: [{
            animationDuration: 5000,
            axisLine: {
                show: true,
                lineStyle: {
                    color: [
                        [0.2, '#0084FF'],
                        [0.8, '#FED147'],
                        [1, '#56D7AB']
                    ],
                    width: 20 //设置环的粗细
                }
            },
            axisTick: {
                show: true
            },
            axisLabel: {
                distance: 6,
                textStyle: {
                    color: 'auto'
                }
            },
            splitLine: { // 分隔线
                length: 20, // 属性length控制线长
                lineStyle: { // 属性lineStyle（详见lineStyle）控制线条样式
                    color: 'auto'
                }
            },
            itemStyle: {
                normal: {
                    color: 'auto'
                }
            },
            radius: '85%',
            pointer: {
                width: 10
            },
            title: {
                offsetCenter: [0, '90%']
            },
            detail: {
                textStyle: {
                    // fontWeight: 'bolder',
                    fontSize: 20,
                    color: '#fff'
                },
                offsetCenter: [0, '58%'],
                formatter: dataName + '\n{value}%'
            },
            // min: 0,
            // max: 100, //县目标最大值
            name: '米类仪表盘',
            type: 'gauge',
            show: false,
            // splitNumber: 10,

            data: [{
                value: data, //县目标实际值
                // name: '县目标100%，第 6 名'
            }]
        }]
    };
    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(el));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });

}


/**
 * 累计完成值及同比增长情况 柱状图表 finishValue()
 */
function finishValue(p) {
    var option = {
        title: {
            left: 'center',
            text: '累计完成值及同比增长情况',
            textStyle: {
                color: "#FDBC0A",
                fontSize: 15,
                fontWeight: "bold"
            }
        },
        tooltip: {
            trigger: 'axis',
            formatter: "<div color='#EAAD0E'>{b}</div> <em style='color:#3B75FA ;'> ● </em>{a1}:{c1}亿元 </br> <em style='color:#58FFF5'> ● </em>{a}:{c}亿元  </br> <em style='color:#EAAD0E'> ● </em>{a2}:{c2}% </br> <em style='color:#FF6C6C'> ● </em>{a3}:{c3}%",
            axisPointer: {
                // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '0%',
            right: '0%',
            bottom: '3%',
            containLabel: true
        },
        legend: {
            x: "center",
            y: "5%",
            data: p.titleList,
            textStyle: {
                color: '#fff',
                fontSize: '12',
            }
        },
        xAxis: [{
            type: 'category',
            data: p.dateList,
            axisPointer: {
                type: 'shadow'
            },
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#fff',
                    fontSize: 15 //设置x轴字体
                }
            },
            axisLine: {
                lineStyle: {
                    color: '#fff',
                    width: 1, //这里是为了突出显示加上的
                }
            },
        }],
        yAxis: [{
            show: false,
        },
            {
                show: false,
            }
        ],
        series: [{
            animationDuration: 3000,
            name: p.lastYearCumulativeTitle,
            type: 'bar',
            data: p.lastYearCumulativeList,
            color: '#58FFF5'
        },
            {
                animationDuration: 3000,
                name: p.currentYearCumulativeTitle,
                type: 'bar',
                data: p.currentYearCumulativeList,
                color: '#3B75FA'
            },
            {
                animationDuration: 3000,
                name: p.currentRatioTitle,
                type: 'line',
                // yAxisIndex: 1,设置y轴起点值
                data: p.currentYearRatioList,
                type: "line",
                symbol: "circle", //设定为实心点
                symbolSize: 10, //设定实心点的大小
                itemStyle: {
                    normal: {
                        color: "#EAAD0E", //小圆点颜色
                        lineStyle: {
                            color: "#EAAD0E", //折线颜色
                            width: 3
                        }
                    }
                }

            },
            {
                animationDuration: 3000,
                name: p.lastYearRatioTitle,
                type: 'line',
                data: p.lastYearRatioList,
                type: "line",
                symbol: "circle", //设定为实心点
                symbolSize: 10, //设定实心点的大小
                itemStyle: {
                    normal: {
                        color: "#FF6C6C", //小圆点颜色
                        lineStyle: {
                            color: "#FF6C6C", //折线颜色
                            width: 3
                        }
                    }
                }

            }
        ],
        color: [{ //设置渐变颜色
            x: 0,
            y: 1,
            x2: 0,
            y2: 0,
            type: 'linear',
            colorStops: [{
                offset: 0,
                color: '#4BBCCF'
            },
                {
                    offset: 1,
                    color: '#0084FF'
                }
            ]
        }],
        barWidth: 15
    };


    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('finish-value'));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}

/**
 * 一二三产图表
 * industryStage(el)
 * el=>元素id  p=>参数
 */
function industryStage(el, p) {
    // 指定图表的配置项和数据
    var option = {
        tooltip: {
            trigger: 'axis',
            // formatter: "<div color='#EAAD0E'>{b}</div> {a1}:{c1}亿元 </br>{a}:{c}亿元  </br> {a2}:{c2}% </br> {a3}:{c3}%",
            axisPointer: {
                // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        grid: {
            left: '0%',
            right: '0%',
            bottom: '0%',
            containLabel: true
        },
        title: {
            left: 'center',
            text: p.title,
            textStyle: {
                color: "#FDBC0A",
                fontSize: 15,
                fontWeight: "bold"
            }
        },
        legend: {
            x: "center",
            y: "5%",
            data: p.titleList,
            textStyle: {
                color: '#fff',
                fontSize: '12',
            }
        },
        xAxis: [{
            type: 'category',
            data: p.dateList,
            splitLine: {
                show: false
            },
            axisPointer: {
                type: 'shadow'
            },
            axisLabel: {
                show: true,
                textStyle: {
                    color: '#fff',
                    fontSize: 15 //设置x轴字体
                }
            },
            axisLine: {
                lineStyle: {
                    color: '#fff',
                    width: 1, //这里是为了突出显示加上的
                }
            },
        }],
        yAxis: [{
            type: 'value',
            name: '亿元',
            // min: 0,
            // interval: 50,
            axisLabel: {
                formatter: '{value} '
            },
            axisLine: {
                lineStyle: {
                    color: '#fff',
                    width: 1, //这里是为了突出显示加上的
                }
            },
            splitLine: {
                show: false
            },
        },
            {
                type: 'value',
                name: '比率',
                // min: 0,
                // max: 150,
                // interval: 50,
                axisLabel: {
                    formatter: '{value} %'
                },
                axisLine: {
                    lineStyle: {
                        color: '#fff',
                        width: 1, //这里是为了突出显示加上的
                    }
                },
                splitLine: {
                    show: false
                },
            }
        ],
        series: [{
            name: p.lastYearCumulativeTitle,
            stack: "00",
            type: 'bar',
            data: p.lastYearCumulativeList,
            color: '#FF6F6F'

        },
            {
                name: p.lastYearNoCompleteTitle,
                type: 'bar',
                stack: "00", //设置叠状柱状图
                data: p.lastYearNoCompleteList,

                color: '#4684F7'
            },
            {
                name: p.currentYearCumulativeTitle,
                type: 'bar',
                stack: "11",
                data: p.currentYearCumulativeList,
                color: '#FFF06F'
            },
            {
                name: p.currentYearNoCompleteTitle,
                type: 'bar',
                stack: "11",
                data: p.currentYearNoCompleteList,
                color: '#6FFFC0'
            },
            {
                name: p.currentRatioTitle,
                type: 'line',
                yAxisIndex: 1, //设置y轴起点值
                data: p.currentYearRatioList,
                type: "line",
                symbol: "circle", //设定为实心点
                symbolSize: 10, //设定实心点的大小
                itemStyle: {
                    normal: {
                        color: "#FC43D7", //小圆点颜色
                        lineStyle: {
                            color: "#FC43D7", //折线颜色
                            width: 3
                        }
                    }
                }

            },
            {
                name: p.lastYearRatioTitle,
                type: 'line',
                yAxisIndex: 1, //设置y轴起点值
                data: p.lastYearRatioList,
                type: "line",
                symbol: "circle", //设定为实心点
                symbolSize: 10, //设定实心点的大小
                itemStyle: {
                    normal: {
                        color: "#0AD514", //小圆点颜色
                        lineStyle: {
                            color: "#0AD514", //折线颜色
                            width: 3
                        }
                    }
                }

            }
        ],
        barWidth: 15
    };

    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(el));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}

/**
 * 指标预警图表
 * warning(el,p)
 * el=>元素ID    p =>参数
 */
function warning(el,p) {
    console.log(p);
    var html = "<div>{b}</div><small style='color: #11B063;'>●</small> {a}:{c}" + p.unit + " </br> <small style='color: #58FFF5;'>●</small> {a1}:{c1}" + p.unit + "  </br> <small style='color: rgba(255,72,72,1);;'>●</small> {a2}:{c2}% ";
    var option = {
        grid: {
            top: "10px",
            left: '15px',
            right: '0%',
            bottom: '0%',
            containLabel: true
        },
        title: {
            left: 'center',
            text: p.title,
            textStyle: {
                color: "#FDBC0A",
                fontSize: 16,
                fontWeight: "bold"
            }
        },
        tooltip: {
            trigger: 'axis',
            formatter: html,
            axisPointer: { // 坐标轴指示器，坐标轴触发有效
                type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        xAxis: {
            name: p.unit,
            type: 'value',
            //去掉网格线
            splitLine: {
                show: false
            },
            axisLine: {
                lineStyle: {
                    color: '#fff'
                }
            },
            axisLabel: {
                formatter: '{value} ',
                color: '#fff'
            }
        },
        yAxis: [{
            type: 'category',
            data: p.categoryDetailsList,
            axisLabel: {
                show: true,
                color: "#fff",
            }
        },
            {
                type: 'category',
                data: p.yujzList,
                axisLabel: {
                    show: true,
                    color: "rgba(255,72,72,1)",
                    fontSize: 16,
                    formatter: function (p) {
                        if (p == 1) {
                            return "预警";
                        }
                    }
                }

            },
        ],
        series: [{
            name: '完成数',
            type: 'bar',
            stack: '总量',
            data: p.actualCompletionValueList
        },
            {
                name: '计划数',
                type: 'bar',
                stack: '总量',
                data: p.planneValueList,
            },
            {
                name: "完成率",
                type: "bar",
                stack: "总量",
                itemStyle: {
                    normal: {
                        color: "RGBA(10, 28, 35, 0.00005)",
                        barBorderRadius: 0,
                        label: {
                            show: true,
                            position: "right",
                            formatter: function (p) {
                                return p.value + "%";
                            }
                        }
                    }
                },
                label: {
                    normal: {
                        show: true,
                        position: 'middle',
                        textStyle: {
                            color: 'rgba(255,72,72,1)',
                            fontSize: 16
                        }
                    }
                },
                data: p.completeAnnualList
            }

        ],
        color: ['#11B063','#58FFF5'],
        barWidth: 15
    };

    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(el));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}

/**
 * 一产 各行业指标行业分类
 */

function IndustryClassification(p) {
    var data1 = p.list;//必须定义    formatte 函数才能使用
    var option = {
        tooltip: {
            show: true,
            trigger: 'item',
            formatter: "{b}: {c} ({d}%)"
        },
        legend: { //图例
            orient: "vertical", //调整位置排列样式
            right: 0, //设置图标文字在右侧
            y: 'center',
            itemWidth: 39,
            itemHeight: 22,
            data: p.nameList,
            textStyle: {
                color: '#fff',
                fontSize: '14'
            },
            formatter: function (name) {
                for (var i = 0; i < data1.length; i++) {
                    if (name == data1[i].name) {
                        return name + '\n' + '\n产值：' + data1[i].actualCompletionValue + ' (万元)\n' + '\n 增幅：' + data1[i].value + ' %\n';
                    }
                }

            }
        },
        title: {
            text: '各行业构成情况',
            textStyle: { //设置主标题样式
                fontWeight: 'normal',
                fontSize: 18,
                color: '#fff'
            },
            x: 'center',
            y: 'center',
        },
        series: [{
            animationDuration: 3000,
            name: '重大项目行业分类',
            type: 'pie',
            radius: ['38%', '60%'], //内半径，外半径
            center: ["50%", "50%"], //移动圆位置
            avoidLabelOverlap: false,
            label: {
                formatter: '{b}\n\n{d}%',
                fontSize: 15,
                color: "#fff",
            },
            labelLine: {
                normal: {
                    show: true
                }
            },
            data: p.list,
            color: ['#6CD5E8', '#9CE84A', '#EB585E', '#FA9D04', '#5C789F', '#E865FF']
        }]
    };
    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('IndustryClassification'));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}


/**
 * 税收收入完成情况
 * taxRevenue(el,p)
 */
function taxRevenue(el, p) {
    console.log(p.list);
    var option = {
        tooltip: {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)",
        },
        title: {
            text: '本年万元',
            textStyle: { //设置主标题样式
                fontWeight: 'normal',
                fontSize: 14,
                color: '#fff' //#075689
            },
            subtext: p.yearIncome,
            subtextStyle: { //设置副标题样式
                color: '#fff',
                fontSize: '18' //#075689
            },
            x: 'center',
            y: 'center',
        },
        series: [{
            animationDuration: 3000,
            name: '税收完成情况',
            type: 'pie',
            radius: ['40%', '65%'],
            center: ['50%', "50%"], //移动圆位置
            label: {
                formatter: '{b}\n\n{d}%',
                fontSize: 15,
                color: "#fff",

            },
            labelLine: {
                show: true,
                length: 20
            },
            data: p.list,
            color: ['#6472FF', '#B167D8', '#FE6867'],
        }],
    };
    // $('.rate').text("20%");
    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(el));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}


/**
 * 点击图例 展示详细图表
 * taxRevenue2(el,p,sysId)
 * el-->元素id    p=>参数   sysId=>图例id
 * 通过sysId来做三产数据处理
 */
function taxRevenue2(el, p, sysId) {
    //处理三产图表数据   进行其他项的分类
    var data = p.currentYearList;
    if (sysId == "345") {
        var obj = {name: "其他", value: ""};
        var val = 0;
        for (var i = 9; i < p.currentYearList.length; i++) {
            val += Number(p.currentYearList[i].value);
        }
        var arr = p.currentYearList.splice(0, 9);
        obj.value = val;
        arr.push(obj);
        data = arr;
    }


    var option = {
        tooltip: {
            trigger: "item",
            formatter: "{a} <br/>{b} : {c} ({d}%)",
        },
        title: {
            text: '本年万元',
            textStyle: { //设置主标题样式
                fontWeight: 'normal',
                fontSize: 14,
                color: '#fff' //#075689
            },
            subtext: p.currentYear,
            subtextStyle: { //设置副标题样式
                color: '#fff',
                fontSize: '18' //#075689
            },
            x: 'center',
            y: 'center',
        },
        series: [{
            animationDuration: 3000,
            name: '',
            type: 'pie',
            radius: ['40%', '65%'],
            center: ['50%', "50%"], //移动圆位置
            label: {
                formatter: '{b}',
                fontSize: 15,
                color: "#fff",

            },
            labelLine: {
                show: true,
                length: 20
            },
            data: data,
            color: ['#B167D8', '#6571FF', '#66D3FE', '#FE852C', '#7CC245', '#C28D3D', '#EEC842', '#80C26A', '#0401AA', "#B7B7B7"],
        }],
    };
    // $('.rate').text("20%");
    //基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById(el));
    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    //自适应大小
    window.addEventListener("resize", function () {
        myChart.resize();
    });
}


/**
 * 三个基础图表函数
 * basicCharts（p）  id => 指标id    date=>选择时间
 */
function basicCharts(id,date) {
    //各县区排名
    $.ajax({
        url: "/index/indicators/queryRanking",
        type: "POST",
        dataType: "json", //返回数据形式为json
        contentType: 'application/json;charset=UTF-8',
        data: JSON.stringify({"industryId": id, "area": "永泰县","date":date}),
        success: function (res) {
            if (res.data == undefined) {
                $("#county-ranking").css("display", "none");//无值就隐藏图表
            }
            if (res.code == "200") {
                countyRanking(res.data,id); //各县区排名

            }
        }
    });

    //增幅仪表盘
    $.ajax({
        url: "/index/indicators/queryInstrumentPanel",
        type: "POST",
        dataType: "json", //返回数据形式为json
        contentType: 'application/json;charset=UTF-8',
        data: JSON.stringify({"industryId": id, "area": "永泰县","date":date}),
        success: function (res) {
            if (res.data == undefined) {
                $("#finish-situation").css("display", "none");//无值就隐藏图表
            }
            if (res.code == "200") {
                dashboard("finish-situation", res.data.ratio, "增幅", res.data.cityIncrease); //增幅仪表盘

            }
        }
    });

    //累计完成值和同比增长情况
    $.ajax({
        url: "/index/indicators/queryCumulativeGrowth",
        type: "POST",
        dataType: "json", //返回数据形式为json
        contentType: 'application/json;charset=UTF-8',
        data: JSON.stringify({"industryId": id, "area": "永泰县","date":date}),
        success: function (res) {
            console.log(1);
            if (res.data == undefined) {
                $("#finish-value").css("display", "none");//无值就隐藏图表
            }
            if (res.code == "200") {
                finishValue(res.data);

            }
        }
    });
}

$(function () {
    //点击选择年份
    $(".time-select  .btns").click(function () {
        //选择年月份
        var date = new Date;
        var year = Number(date.getFullYear());
        var year1 = year - 1;
        var year2 = year - 2;
        var text = '';
        text += '\
              <option value="-">-年份-</option>\
              <option value="' + year + '">' + year + '</option>\
              <option value="' + year1 + '">' + year1 + '</option>\
               <option value="' + year2 + '">' + year2 + '</option>\
             ';

        $(".select-year").html(text);
    });

    //指定要操作的元素的click事件停止传播—定义属性值data-stopPropagation的元素点击时停止传播事件
    $("body").on('click','[data-stopPropagation]',function (e) {
        e.stopPropagation();
    });
});